package com.woniu.service.Impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.woniu.dao.HouseMapper;
import com.woniu.pojo.House;
import com.woniu.service.HouseService;
@Service
@Transactional
public class HouseServiceImpl implements HouseService {
	@Autowired
	private HouseMapper houseMapper;
	@Override
	public int addHouse(House house) {
		String serialNum="123456789";
		Integer hs_id = house.getHs_id();
		String house_id = house.getHouse_id();
		house.setHouse_id(serialNum+hs_id+house_id.substring(0,house_id.indexOf("-"))+house_id.substring(house_id.indexOf("-")+1));
		int addHouse = houseMapper.addHouse(house);
		return addHouse;
	}
	@Override
	public House selectHouseById(String house_id) {
		House house = houseMapper.selectHouseById(house_id);
		return house;
	}
	@Override
	public int updateHouseJurisdictionType(String user_share, String user_num, String h_id) {
		int rowCount = houseMapper.updateHouseJurisdictionType(user_share, user_num, h_id);
		// TODO Auto-generated method stub
		return rowCount;
	}
	
}
